<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./font/iconfont.css">

    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            width: 100%;
            height: 100%;
        }

        body {
            display: flex;
            flex-direction: column;
        }

        header {
            width: 100%;
            height: 50px;
            background-color: lightskyblue;
            display: flex;
        }

        h2 {
            width: 200px;
            color: white;
            line-height: 50px;
            margin-left: 20px;
        }

        .menu {
            display: inline-block;
            height: 50px;
            width: 900px;
            line-height: 50px;
        }

        ul {
            flex: 1;
            display: flex;
            list-style: none;
            justify-content: space-between;
        }

        ul>li {
            width: 50%;
            line-height: 50px;
            color: white;
        }

        ol {
            width: 100%;
            height: 100%;
            list-style: none;
        }

        .content {
            width: 100%;
            flex: 1;
            display: flex;
        }

        .left {
            width: 250px;
            height: 100%;
            background-color: lightslategray;
        }

        ol>li {
            width: 100%;
            height: 30px;
            /* background-color: beige; */
            text-align: center;
            position: relative;
            color: white;
        }

        .one {
            position: absolute;
            top: 10px;
            left: 20px;
            color: white;
        }

        .jian {
            position: absolute;
            left: 200px;
            top: 10px;
            color: white;
        }

        .right {
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        .top {
            width: 100%;
            height: 30px;
            background-color: lavenderblush;
            border-bottom: 1px solid #000;
            display: flex;

        }

        .hello {
            width: 1100px;
            /* background-color: #fff; */
            padding-left: 50px;
            box-sizing: border-box;
        }

        .dod {
            flex: 1;
        }

        .center {
            height: 100px;
            /* background-color: antiquewhite; */
            display: flex;
            margin-top: 10px;
        }

        .fir {
            width: 24%;
            height: 100%;
            margin-left: 1%;
            background-color: aqua;
            position: relative;
        }

        .fir:nth-child(2) {
            background-color: aquamarine;
        }

        .fir:nth-child(3) {
            background-color: chartreuse;
        }

        .fir:nth-child(4) {
            background-color: gainsboro;
        }

        h3 {
            margin-left: 20px;
        }

        p {
            font-size: 30px;
            margin-left: 20px;
            margin-top: 10px;
        }

        .qian {
            position: absolute;
            top: 30px;
            left: 270px;
            font-size: 30px;
        }

        .tu {
            width: 99%;
            height: 350px;
            display: flex;
            padding-left: 1%;
            margin-top: 10px;
        }

        .zzt {
            width: 49%;
            height: 100%;
            background-color: aqua;
            margin-right: 1%;
        }

        .zxt {
            width: 50%;
            height: 100%;
            background-color: aquamarine;
            margin-left: 1%;
        }

        .biao {
            flex: 1;
            width: 100%;
            /* background-color: aquamarine; */
        }

        table {
            width: 99%;
            height: 94%;
            margin-left: 1%;
            margin-top: 1%;
            /* background-color: antiquewhite; */
            text-align: center;
        }

        td {
            border-bottom: 1px solid orange;
            border-collapse: collapse;
        }
    </style>
</head>

<body>
    <header>
        <h2>后台管理系统</h2>
        <span class="iconfont icon-xitongcaidan menu"></span>
        <ul>
            <li>当前用户: bootstrap中文</li>
            <li>角色:管理员</li>
        </ul>
    </header>
    <div class="content">
        <div class="left">
            <ol>
                <li><span class="iconfont icon-shouye one"></span> 后台首页<span class="iconfont icon-jiantou jian"></span>
                </li>
                <li><span class="iconfont icon-caidan_o one"></span> 设计元素 <span
                        class="iconfont icon-jiantou jian"></span></li>
                <li><span class="iconfont icon-bianji one"></span> 表单元素 <span class="iconfont icon-jiantou jian"></span>
                </li>
                <li><span class="iconfont icon-diannao one"></span> 示争页面 <span
                        class="iconfont icon-jiantou jian"></span></li>
                <li><span class="iconfont icon-columns one"></span> 常用列表 <span
                        class="iconfont icon-jiantou jian"></span></li>
                <li><span class="iconfont icon-jiaobenguanli one"></span> 科本插件 <span
                        class="iconfont icon-jiantou jian"></span></li>
                <li><span class="iconfont icon-zhuzhuangtu one"></span> 统计图表<span
                        class="iconfont icon-jiantou jian"></span></li>
            </ol>
        </div>
        <div class="right">
            <div class="top">
                <div class="hello">欢迎首页</div>
                <div class="dod">页面操作</div>
            </div>
            <div class="center">
                <div class="fir">
                    <h3>今日收入</h3>
                    <p>100,000.00</p>
                    <span class="iconfont icon-shouye1 qian"></span>
                </div>
                <div class="fir">
                    <h3>昨日收入</h3>
                    <p>200,000.00</p>
                    <span class="iconfont icon-Euro- qian"></span>
                </div>
                <div class="fir">
                    <h3>月麻累计收入</h3>
                    <p>1000,000.00</p>
                    <span class="iconfont icon-qiandai qian"></span>
                </div>
                <div class="fir">
                    <h3>年度累计收入</h3>
                    <p>5,000,000.00</p>
                    <span class="iconfont icon-shengqian qian"></span>
                </div>
            </div>
            <div class="tu">
                <div class="zzt"></div>
                <div class="zxt"></div>
            </div>
            <div class="biao">
                <table>
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>订单号</th>
                            <th>商品名称</th>
                            <th>time</th>
                            <th>状态</th>
                            <th>处理情况</th>
                        </tr>
                    </thead>
                    <tbody>
                        <!-- <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                        </tr>
                         -->

                    </tbody>
                </table>
            </div>
        </div>

    </div>
</body>

</html>
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.4.0/echarts.js"></script>
<script src="./promise-ajax.js"></script>
<!-- <script src="./num.json"></script> -->
<script>
    var zzt = document.querySelector('.zzt')
    var e = echarts.init(zzt)
    e.setOption({
        title: {
            text: '每月收入'
        },
        legend: {
            // bottom: 20,
            top: 10,
            right: 200,
        },
        xAxis: {
            splitLine: {
                show: true,
                lineStyle: {
                    type: 'line',
                }
            },
            data: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],

        },
        yAxis: [
            {

                // name: 'Sales Over Time',//名字
                min: 1500,
                max: 5000,
                //纵轴分组
                splitNumber: 7,
                splitLine: {
                    show: true,
                    lineStyle: {
                        type: 'line',
                    }
                }
            }
        ],
        series: [

            {
                name: '当前每月收入',
                type: 'bar',
                data: [2600, 1600, 1700, 3300, 4700, 3500, 1700, 2500, 2300, 1800, 3900, 1900],
                color: 'blue',
                barWidth: 15,
                itemStyle: {
                    normal: {
                        color: 'blue',
                        // barWidth: 20,
                    }
                },

            },
            {
                name: '同期每月收入',
                type: 'bar',
                data: [2100, 1700, 1900, 3000, 4000, 3700, 1700, 2000, 2700, 2200, 3700, 3600],
                smooth: true,
                barWidth: 15,
                itemStyle: {
                    normal: {
                        color: 'lightblue',
                    }
                }

            }
        ]
    });

    var zzt = document.querySelector('.zxt');
    var x = echarts.init(zzt);
    x.setOption({
        title: {
            text: '每年收入走势',
            left: 10,
            top: 5
        },
        legend: { //图例
            top: 10,
            right: 200,
        },
        tooltip: {
            trigger: 'axis'
        },
        // grid: {
        //     left: '3%',
        //     right: '4%',
        //     bottom: '3%',
        //     containLabel: true
        // },
        // toolbox: {
        //     feature: {
        //         saveAsImage: {}
        //     }
        // },
        xAxis: {
            // type: 'category',
            // boundaryGap: false,
            // max: 2009,
            // min: 2020,
            // splitNumber: 11,
            data: [2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020],
            splitLine: {
                show: true,
                lineStyle: {
                    type: 'line',
                }
            }
        },
        yAxis: {
            max: 80,
            min: 20,
            splitNumber: 6,
            splitLine: {
                show: true,
                lineStyle: {
                    type: 'line',
                }
            }
            // boundaryGap: [0.2, 0.2]
        },
        series: [
            {
                name: '每年收入走势',
                smooth: true,//平滑曲线
                type: 'line',
                symbol: 'circle',
                color: 'green',
                data: [50, 55, 60, 40, 45, 40, 65, 40, 69, 20, 72, 60],
            },
            {
                name: '每年同期收入走势',
                type: 'line',
                symbol: 'circle',
                color: 'gray',
                data: [48, 50, 51, 49, 40, 35, 65, 45, 59, 30, 72, 58],
                smooth: true,
            }

        ]
    });


    async function render() {
        var data = await ajax('get', " ./num.json", {})
        var datalis = data.list
        var str = datalis.map((item) => {
            return  ` <tr>
                            <td>${item.id}</td>
                            <td>${item.count}</td>
                            <td>${item.name}</td>
                            <td>${item.time}</td>
                            <td>${item.do}</td>
                            <td>1</td>
                        </tr>  `
        }).join('')
        document.querySelector('tbody').innerHTML = str
    }
    render()


</script>